package org.vacoor.ticket.bean.param.impl;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.vacoor.ticket.bean.SeatType;
import org.vacoor.ticket.bean.Station;
import org.vacoor.ticket.bean.param.Parameter;

public class QueueParam implements Parameter{
	private Date date;
	private String trainNo;
	private String trainCode;
	private SeatType seatType;
	private Station from;
	private Station arrive;
	//这个不传有时候会返回错误信息
	//余票信息
	private String ticketInfo = "";
	
	public QueueParam(Date date, String trainNo, String trainCode,
			SeatType seatType, Station from, Station arrive, String ticket) {
		this.date = date;
		this.trainNo = trainNo;
		this.trainCode = trainCode;
		this.seatType = seatType;
		this.from = from;
		this.arrive = arrive;
		this.ticketInfo = ticket;
	}


	@Override
	public String getQueryString() {
		return 
			//
			"train_date=" + new SimpleDateFormat("yyyy-MM-dd").format(date) +
			"&train_no=" + trainNo + 
			"&station=" + trainCode +
			"&seat=" + seatType.getValue() +
			"&from=" + from.getCode() +
			"&to=" + arrive.getCode() + 
			"&ticket=" + ticketInfo;	//这个非必须
	}
}
